<?php

$_CLASS['campagneCLS'] = "class_php/campagneCLS.php";
$_CLASS['prossimoClienteCLS'] = "class_php/prossimoClienteCLS.php";

class dialer extends Module
{
	var $socket = 0;
	var $analyzeArray = 1;
	var $analyzeError = 1;
	var $connDB = 1;
	var $func = 1;
	var $funcDB = 0;
	var $sqlFunc = 1;
	var $request = array();
	var $smarty = 1;
	var $session = array();
	var $impBase = array();
	var $fldError = array();
	var $usrError = array();
	var $sysError = array();
	var $usrInfo = array();
	var $usrInfoFuncJS = '';
	var $usrInfoValueBtn = '';
	var $extClass = array();
	var $appLog = 1;
	var $lastPageNo = 0;
	var $menu = 1;
	var $security = 1;
	
	function start()
	{
// 		if ( $this->request["save"] == "S" )
// 		{
// 			
// // 			if ( $this->campagneCLS->startupDialer() )
// // 			{
// 				$valor =  exec('ll >> /home/svil/elenco.txt');
// //  				exec('/home/svil/AutoDialer/startup.sh');
// 				$this->usrInfo[] = "Operazione eseguita: $valor";	
// // 			}
// 			
// 		
// 		}
// 		elseif ( $this->request["save"] == "N" )
// 		{
// 			$valor = exec('/home/svil/AutoDialer/shutdown.sh');
// 			$this->usrInfo[] = "Operazione eseguita: $valor";
// 	
// 		}
		
		if ( $this->request["save"] == "S" )
		{
			$splitOperatore = split('\|',$this->request["diasableOp"]);

			$this->prossimoClienteCLS->interfaceAgentInsert("onLogout",$splitOperatore[0],'0');
			
			//inposto il vecchio login come lavorato in modo 
			$this->request["idStatoOperatore"] = $this->prossimoClienteCLS->interfaceAgentCheck("onLogin",$this->request["diasableOp"],'0,1');
			$this->prossimoClienteCLS->interfaceAgentUpdate($this->request["idStatoOperatore"],'3');

			$this->usrInfo[] = "Operazione eseguita";
		}

		$this->campagneCLS->loadOperatoriLoggati();

		$this->fillValue("operatoriLoggati", $this->request);

	}

	
	function show()
	{		
		//$this->smarty->assign("ajax","yes");
		
		$this->smarty->assign("mod","campagne");
		$this->smarty->assign("do","dialer");
		$this->smarty->assign("page","home");

		$this->smarty->display($this->session["ruolo"]."/campagne/dialer.tpl.html");
	}
}

?> 
 
 
